//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ScientificWorkflow.UIDesigner
{
    #region nameSpaces
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Microsoft.Research.ScientificWorkflow.TridentModel;
    using Microsoft.Research.ScientificWorkflow.TridentComposer;

    #endregion

    /// <summary>
    /// Interaction logic for SimpleBlackboxActivityBody.xaml
    /// </summary>
    public partial class SimpleBlackboxActivityBody : UserControl
    {        
        #region Declaration

        /// <summary>
        /// Holds the activity model
        /// </summary>
        private BaseModel activityModel;
 
        #endregion

        #region Constructor

        /// <summary>
        /// Create the activityBody for the simple activity model.
        /// </summary>
        /// <param name="model">
        /// SimpleActivityModel.
        /// </param>
        /// <param name="dataTypes">
        /// Datatypes.
        /// </param>
        /// <param name="paramElements">
        /// The parameter elements.
        /// </param>
        public SimpleBlackboxActivityBody(BaseModel model)
        {
            InitializeComponent();
            this.activityModel = model;
            this.Name = model.UniqueId;
        }
   
        #endregion

        #region Properties
        /// <summary>
        /// get and sets the Border Height
        /// </summary>
        public double BodyHeight
        {
            get
            {
                return this.Height;
            }
            set
            {
                this.Height = value;
            }
        }

        /// <summary>
        /// get and sets the Border Width
        /// </summary>
        public double BodyWidth
        {
            get
            {
                return this.Width;
            }
            set
            {
                this.Width = value;
            }
        }

        /// <summary>
        /// get and sets the Body BackGround 
        /// </summary>
        public Brush BodyBackground
        {
            get
            {
                return this.brdrBodyHolder.Background;
            }
            set
            {
                this.brdrBodyHolder.Background = value;
            }
        }

        #endregion

        #region privateMethods

           
        #endregion

        #region public methods

        /// <summary>
        /// Get the position where the binding end point has to join the body.
        /// </summary>
        /// <returns>The point location</returns>
        public Point GetInputBorderConnectionPosition(UIElement relativeTo)
        {
            // Get the midpoint of the activity header.
            Point startPoint = new Point(0.0, this.inputParameterOutline.ActualHeight / 2.0);
            return this.inputParameterOutline.TranslatePoint(startPoint, relativeTo);
        }

        /// <summary>
        /// Get the position where the binding start point has to join the body.
        /// </summary>
        /// <returns>The point location.</returns>
        public Point GetOutputBorderConnectionPosition(UIElement relativeTo)
        {
            // Get the midpoint of the activity header.
            Point startPoint = new Point(this.outputParameterOutline.ActualWidth, this.outputParameterOutline.ActualHeight / 2.0);
            return this.outputParameterOutline.TranslatePoint(startPoint, relativeTo);
        }

        #endregion
    }
}
